C# Regular Exression "^[a-zA-Z]" or "[^a-zA-Z]"

Posted by winmyan on Stack Overflow See other posts from Stack Overflow or by winmyan
Published on 2010-05-07T18:29:51Z Indexed on 2010/05/07 18:38 UTC
Read the original article Hit count: 291

Filed under:
|
|
|

Is there a differnet between ^[a-zA-Z] or [^a-zA-Z]?

When I check in C#,

Regex.IsMatch("t", "^[a-zA-Z]")  // Return true (I think it's correct)

Regex.IsMatch("t", "[^a-zA-Z]")  // Return false

There are alot of web site using [^a-zA-Z] for alphabet. I'm not really sure which one is correct answer.

Could someone please shed the light?

© Stack Overflow or respective owner

Related posts about regex

Related posts about regular